<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=320; user-scalable=no">
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>掃描電子發票</title>
<style type="text/css">
a {
	display: block;
	width: 180px;
	height: 40px;
	line-height: 40px;
	text-align: center;
	font-size: 16px;
	font-weight: 900;
	background-color: pink;
	border: 1px solid #000;
	margin: 10px;
}
</style>
<script src="../js/cordova-1.6.1.js"></script>
<script type="text/javascript" src="../js/barcodescanner.js"></script>
<link href="../css/jquery.mobile-1.1.0.css" rel="stylesheet"
	type="text/css" />
<script src="../js/jquery-1.7.2.js"></script>

<!-- 
    <script src="js/phonegap-desktop.js"></script>  -->
<script src="../js/jquery.mobile-1.1.0.js"></script>


<script type="text/javascript" charset="utf-8">
	console.log('on scan.html');
	var onDeviceReady = function() {
		console.log('Device Ready.');
		scanCode();
	};

	function init() {
		document.addEventListener("deviceready", onDeviceReady, true);
		scanCode();
	}

	var scanCode = function() {
		alert('scan code');
		window.plugins.barcodeScanner.scan(function(result) {
			alert("Scanned Code: " + result.text + ". Format: " + result.format
					+ ". Cancelled: " + result.cancelled);
		}, function(error) {
			alert("Scan failed: " + error);
		});
	}

	var encodeText = function() {
		window.plugins.barcodeScanner.encode(BarcodeScanner.Encode.TEXT_TYPE,
				"12345678", function(success) {
					alert("Encode success: " + success);
				}, function(fail) {
					alert("Encoding failed: " + fail);
				});
	}
</script>
</head>
<body>
scaning....
</body>
</html>